home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / toolpack.000 / toolpack / toolpack1.2 / scriptsource / inst.s < prev    next >
Encoding:
Text File  |  1993-10-04  |  4.1 KB  |  131 lines

  1. #! /bin/csh
  2. #  inst is a csh script to instrument a Fortran program using ISTAN.
  3. #  The output report is produced using ISTAL.
  4. #
  5. #
  6. #  Invocation:
  7. #
  8. #  inst Fortran_source_file instrumented_Fortran_source
  9. #
  10. #  Fortran_source_file is the name of a file containing one or more Fortran
  11. #  program units that may contain embedded assertions.  The instrumented
  12. #  source is placed in instrumented_Fortran_source.  Both of these files
  13. #  should have a ".f" suffix.  Files _.ANSTATICSUM and _.ANANNOLIST are
  14. #  created for later use by script rundoc.
  15. #
  16. #  Output to stdout is a report consisting of two parts:  (1) a program
  17. #  listing annotated with segment and assertion identification numbers,
  18. #  (2) a static count of Fortran key words and other program elements.
  19. #
  20. #  Check command line validity.
  21. if ( $#argv < 2 ) then
  22. TOOLPACKPATH/toolpack1.2/util/echoerr \
  23. Invocation:
  24. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  25. TOOLPACKPATH/toolpack1.2/util/echoerr \
  26. inst Fortran_source_file instrumented_Fortran_source
  27. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  28. TOOLPACKPATH/toolpack1.2/util/echoerr \
  29. An instrumentation report is sent to standard output
  30. TOOLPACKPATH/toolpack1.2/util/echoerr \
  31. and may be redirected to a file.
  32. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  33. TOOLPACKPATH/toolpack1.2/util/echoerr \
  34. Files '"_.ANSTATICSUM"' and '"_.ANANNOLIST"' are saved in the working
  35. TOOLPACKPATH/toolpack1.2/util/echoerr \
  36. directory for later use by script rundoc.
  37. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  38.    exit
  39. endif
  40. #  Check that Fortran_source_file exists.
  41. if ( -e $1 == 0 ) then
  42. TOOLPACKPATH/toolpack1.2/util/echoerr \
  43. "'$1' does not exist."
  44.    exit
  45. endif
  46. #
  47. #  Create PFS.  If PFS already exists, exit with an advisory message.
  48. #
  49. if ( -e _.TOOLPACK == 0 ) then
  50.    mkdir _.TOOLPACK
  51. else
  52. TOOLPACKPATH/toolpack1.2/util/echoerr \
  53. Toolpack-created directory '"_.TOOLPACK"' exists. \
  54. Remove with script '"discard"'.
  55.    exit
  56. endif
  57. #  Make a tab-free copy of the Fortran source and use it as source.
  58. set src = lx.src$$
  59. expand $1 > _.TOOLPACK/$src
  60. #  Lexer token stream file name.
  61. set tkn = _.lxtkn
  62. #  Lexer comment file name.
  63. set cmt = _.lxcmt
  64. #  Create the interprocess file IST.CMD and append parameters for ISTLX.
  65. TOOLPACKPATH/toolpack1.2/util/mkipf \
  66. $src - $tkn $cmt
  67. #
  68. #  Invoke ISTLX.
  69. #
  70. TOOLPACKPATH/toolpack1.2/exec/istlx.u
  71. #
  72. #  If lexer errors are reported, advise user to obtain listing and exit.
  73. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  74. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  75. TOOLPACKPATH/toolpack1.2/util/echoerr \
  76. 'Program has lexical scanning errors.  Invoke script "getlst"'
  77. TOOLPACKPATH/toolpack1.2/util/echoerr \
  78. to obtain a listing showing statement and token numbers.
  79. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  80.    /bin/rm -r _.TOOLPACK
  81.    exit
  82. endif
  83. #
  84. #  Create parameters for ISTAN.
  85. #
  86. #  The static summary file.
  87. set statsum = \#_.ANSTATICSUM
  88. #  The annotated token stream.
  89. set antkn = an.atk$$
  90. #  The annotated comment stream.
  91. set ancmt = an.acm$$
  92. #  The readable summary file (will be discarded because the same
  93. #  information will be created by ISTAL later).
  94. set pitch = an.dis$$
  95. #  Create the interprocess file IST.CMD and append parameters for ISTAN.
  96. TOOLPACKPATH/toolpack1.2/util/mkipf \
  97. $tkn $cmt \#$2 $statsum $antkn $ancmt $pitch \
  98. "rund='_.ANRUNDATA' asse trac='Trace_Requests','Trace_Output' list='_.XREPORT'"
  99. #
  100. #  Invoke ISTAN.
  101. #
  102. TOOLPACKPATH/toolpack1.2/exec/istan.u
  103. #
  104. #  Create the annotated listing file by unscanning the annotated token
  105. #  and comment streams.
  106. set anlst = \#_.ANANNOLIST
  107. #  Create the interprocess file IST.CMD and append parameters for ISTPL.
  108. TOOLPACKPATH/toolpack1.2/util/mkipf \
  109. $antkn $ancmt $anlst -
  110. #
  111. #  Invoke ISTPL.
  112. #
  113. TOOLPACKPATH/toolpack1.2/exec/istpl.u
  114. #
  115. #  Create an output file for ISTAL.
  116. set repout = alout$$
  117. #  Create the interprocess file IST.CMD and append parameters for ISTAL.
  118. #  (.../instREP is an input document for ISTAL written to report the
  119. #  desired information.  The output will be nroff'ed to produce the
  120. #  static summary report and the annotated listing.)
  121. TOOLPACKPATH/toolpack1.2/util/mkipf \
  122. \#TOOLPACKPATH/toolpack1.2/util/instREP $repout
  123. #
  124. #  Invoke ISTAL.
  125. #
  126. TOOLPACKPATH/toolpack1.2/exec/istal.u
  127. nroff _.TOOLPACK/$repout
  128. #
  129. /bin/rm -r _.TOOLPACK
  130. #
  131.